//
//  ZQQBannerViewController.m
//  ZQQBannerView
//
//  Created by MoDao-iOS on 2017/7/15.
//  Copyright © 2017年 wushengdubai. All rights reserved.
//

#import "ZQQBannerViewController.h"
#import "ZQQBannerView.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import "ZQQPicModel.h"

@interface ZQQBannerViewController ()

/** bannerView*/
@property (nonatomic, strong) ZQQBannerView *bannerView;

@end

@implementation ZQQBannerViewController

- (ZQQBannerView *)bannerView {
    if (!_bannerView) {
        _bannerView = [ZQQBannerView bannerViewWithLoadImageBlock:^(UIImageView *imgView, NSURL *url) {
            [imgView sd_setImageWithURL:url];
        } withPagePosition:BannerViewPageControlPositionRight];
        _bannerView.backgroundColor = [UIColor yellowColor];
        [self.view addSubview:_bannerView];
    }
    return _bannerView;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor redColor];
    self.bannerView.frame = CGRectMake(0, 0, self.view.bounds.size.width, 150);
    
    NSArray *arr = @[@"http://easyread.ph.126.net/G8GtEi-zmPQzvS5w7ScxmQ==/7806606224489671909.jpg", @"http://www.qqpk.cn/Article/UploadFiles/201312/20131212154331984.jpg", @"http://epaper.syd.com.cn/sywb/res/1/20080108/42241199752656275.jpg"];
    NSMutableArray *mutArr = [NSMutableArray array];
    for (NSString *str in arr) {
        NSURL *url = [NSURL URLWithString:str];
        ZQQPicModel *model = [[ZQQPicModel alloc] init];
        model.adImgURL = url;
        [mutArr addObject:model];
    }
    self.bannerView.picModels = mutArr;
}


@end
